#include "timingswitchcmd.h"
#include"ProtocalIdentifier.h"
#include "NetworkCommonFunction.h"
#include "QDebug"

TimingSwitchCmd::TimingSwitchCmd(const QString& cmdType, const QString& time):
		SenderCommand(GetProtocalIdentifier("TimingSwitch")),
		m_CmdType(cmdType),
		m_Time(time)
{

}

void TimingSwitchCmd::constructCommandData(QByteArray &commandData)
{
	unsigned long commandCode = m_CommandType;
	unsigned long commandLength;

	QByteArray cmdTypeLocal8 = m_CmdType.toLocal8Bit();
	QByteArray timeLocal8 = m_Time.toLocal8Bit();

	commandLength =cmdTypeLocal8.size()+timeLocal8.size();

	commandData.append(FBtoNetworkCharP(commandCode),4);
	commandData.append(FBtoNetworkCharP(commandLength),4);
	commandData.append(cmdTypeLocal8);
	commandData.append(timeLocal8);
}
